package com.hspedu.newData.dmsxl.哈希表;

import java.util.HashMap;
import java.util.HashSet;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-06 
 * @Version: 1.0
 */

public class LC1207独一无二的出现次数 {

    public boolean uniqueOccurrences(int[] arr) {

        HashMap<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            map.put(arr[i],map.getOrDefault(arr[i],0) + 1);
        }
        HashSet<Integer> set = new HashSet<>();

        for (Integer value : map.values()) {
            if (set.contains(value)){
                return false;
            }
            set.add(value);
        }
        return true;
    }
}
